// index.js
// 获取应用实例
const app = getApp()

Page({
  data: {
    tabs: [
      {
        id: 0,
        title: "首页(父)",
        isActive: true
      },{
        id: 1,
        title: "原创(父)",
        isActive: false
      },{
        id: 2,
        title: "分类(父)",
        isActive: false
      },{
        id: 3,
        title: "关于(父)",
        isActive: false
      }
    ]
  },
  handleItemChange(e){
    let index = e.detail.index;
    let list = JSON.parse(JSON.stringify(this.data.tabs))
      list.forEach((v,i)=>{
          i === index ?
          v.isActive = true :
          v.isActive = false
      })
      // this.setData() 来修改data中的数据
      this.setData({
        tabs: list
      })
  }
})
